import React, { PureComponent, createRef, forwardRef } from 'react'

const HWFunc = forwardRef(function(props, ref){
  return (
    <div ref={ref}>函数组件</div>
  )
})

export class App extends PureComponent {
  constructor() {
    super()
    this.state = {}

    this.HWRef = createRef()
  }
  

  getDOM() {
    console.log(this.HWRef.current);
  }
  render() {
    return (
      <div>
        <HWFunc ref={this.HWRef}></HWFunc>
        <button onClick={() => this.getDOM()}>获取函数组件DOM</button>
      </div>
    )
  }
}

export default App